<?php

namespace app\admin\model;

use think\Model;


class TeacherCollection extends Model
{

    private $c_sql = "CREATE TABLE `fa_teacher_collection` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `teacher_detail_id` int(10) DEFAULT NULL COMMENT '教师课程id',
  `user_id` int(10) DEFAULT NULL COMMENT '用户id',
  `addtime` datetime DEFAULT NULL COMMENT '收藏时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收藏教师表';";

    

    // 表名
    protected $name = 'teacher_collection';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    
    /**
     * 关联教师课程详情
     */
    public function teacherDetail()
    {
        return $this->hasOne(TeacherDetail::class, 'id', 'teacher_detail_id', [], 'LEFT')->setEagerlyType(0);
    }

    public function teacherDetailS()
    {
        return $this->hasOne(TeacherDetail::class, 'id', 'teacher_detail_id', [], 'LEFT')->with(['identity','clubDtlS']);
    }




}
